<!DOCTYPE html>
<meta charset=utf-8>
<title>Controlled frame for Cache API test with credentials</title>
<script>

function xhr(url, username, password) {
  return new Promise(function(resolve, reject) {
    var xhr = new XMLHttpRequest(), async = true;
    xhr.open('GET', url, async, username, password);
    xhr.send();
    xhr.onreadystatechange = function() {
      if (xhr.readyState !== XMLHttpRequest.DONE)
        return;
      if (xhr.status === 200) {
        resolve(xhr.responseText);
      } else {
        reject(new Error(xhr.statusText));
      }
    };
  });
}

</script>
